package com.yy.common.adapter.animation;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.view.View;

/**
 * User: gongyongfeng2@yy.com
 * Date: 2020/4/25 20 :51
 */
public class ScaleAnimation extends BaseAnimation {
    private static final float DEFAULT_SCALE = 0.5f;
    private final float mFrom;

    public ScaleAnimation() {
        this(DEFAULT_SCALE);
    }

    public ScaleAnimation(float from) {
        mFrom = from;
    }

    @Override
    public Animator[] getAnimators(View view) {
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", mFrom, 1.0f);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", mFrom, 1.0f);

        return new Animator[]{scaleX, scaleY};
    }
}
